<template>
  <ant-modal
    modalWidth="600"
    modalHeight="450"
    :visible="open"
    v-if="open"
    :modal-title="formTitle"
    :adjust-size="true"
    :maskClosable="false"
    @cancel="cancel"
  >
    <a-form-model ref="form" :model="form"  slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :xs="12" :md="12" :sm="12">
          <a-form-model-item :label="form.accessoryNumber ? '配件单号':''">
          <a-button  type="primary" :disabled="false" @click="handleChooseAccessory" v-if="!bizAccessoryId && !form.accessoryNumber">
            关联配件单
          </a-button>
            <a-input style="width:200px" v-if="form.accessoryNumber" :readOnly="true" v-model="form.accessoryNumber" placeholder="请关联配件单" />
          <a-button style="margin-left:20px;" type="primary" @click="handleAdd" v-hasPermi="['biz:bizOrderAccessory:add']" v-if="!bizAccessoryId && !form.accessoryNumber">
            <a-icon type="plus" />新增
          </a-button>
          </a-form-model-item>
        </a-col>
        <a-col :xs="12" :md="12" :sm="12" v-if="form.accessoryNumber">
          <a-form-model-item label="备注">
            <a-input style="width:200px"  :readOnly="true" v-model="form.remark" disabled placeholder="备注" />
          </a-form-model-item>
        </a-col>
        <a-col :lg="24" :md="24" :sm="24">
          <a-form-model-item label="配件图片">
            <a-upload
              :headers="headers"
              :file-list="fileList"
              list-type="picture-card"
              :customRequest="handleChange"
              :remove='handleRemove'
            >
                上传
            </a-upload>
          </a-form-model-item>
        </a-col>
      </a-row>
      
      <BizAccessoryListForm ref="BizAccessoryListForm" @ok="selectOk"></BizAccessoryListForm>
      
      <!-- 增加 -->
      <biz-parts-add-form
        v-if="showAddModal"
        ref="bizPartsAddForm"
        :statusOptions="statusOptions"
        @ok="setAccessoryInfo"
        @close="showAddModal = false"
      />
    </a-form-model>
      <template slot="footer">
          <a-button @click="cancel">
            取消
          </a-button>
          <a-button type="primary" :disabled="false" @click="submitForm(true)">
            保存
          </a-button>
        </template>
  </ant-modal>
</template>
<script>
import AccessoryForm from './AccessoryForm'
export default {
  ...AccessoryForm
}
</script>
<style lang="less" scoped>
.table-operations, body tr.ant-table-expanded-row:hover .table-operations {
  padding-bottom: 8px;
  text-align: right;
}
.table-operations {
  margin-bottom: 16px;
}
.table-operations > button,
.table-operations .ant-input-affix-wrapper{
  margin-right: 8px;
}
.table_title {
  float: left;
  padding-left: 8px;
  font-weight: 600;
  color: #222222;
  line-height: 30px;
}
</style>
